<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of os_register
 *
 * @author GodSon
 */
class Os_register extends CI_Model{
    //put your code here
    function __construct() {
        parent::__construct();
    }
    
    var $name = "";
    var $password = "";
    var $email = "";
    var $regtime = "";
    /**
     *  注册时间
     * @return type 
     */
    function register(){
        $this->load->helper('security');
        $this->name = $this->input->post('username');
        $this->password = do_hash($this->input->post("password"),'md5');
        $this->email = $this->input->post("email");
        $this->regtime  = time();
        return $this->db->insert("gd_user",$this);
    }
    
    /**
     *  用户名唯一性检测
     * @return type 
     */
    function checkNameUni(){
         $this->name = $this->input->post('username');
        $sql = "select * from gd_user where name= ?";
        $query = $this->db->query($sql,array($this->username));
        return $query->num_rows();
    }
}

?>
